from django.db import models
"""
CREATE TABLE newyouth."members" (
    "id" serial NOT NULL PRIMARY KEY,
    "members_id" integer NOT NULL,
    "members_name" character varying(64) NOT NULL,
    "username" character varying(100) NOT NULL,
    "password" character varying(100) NOT NULL,
    "members_phone" character varying(11) NOT NULL,
    "members_email" character varying(64) NOT NULL
);
select * from newyouth."members"
"""
# Create your models here.
class Members(models.Model):
    members_id = models.IntegerField(verbose_name="用户编码")
    members_name = models.CharField(verbose_name="姓名", max_length=64)
    username = models.CharField(max_length=100, verbose_name="用户名")
    password = models.CharField(max_length=100, verbose_name="密码")
    members_phone = models.CharField(verbose_name="手机号码", max_length=11)  # 通常手机号码是11位
    members_email = models.EmailField(verbose_name="邮箱", max_length=64)  # 邮箱长度通常更长

    class Meta:
        ordering = ['id'] # 设置了默认的排序方式，按照 id 字段升序排列。
        managed = False #表示Django不会为这个模型创建或修改数据库表，这通常用于那些你不想Django自动管理的表。
        verbose_name = "成员"
        verbose_name_plural = verbose_name
        db_table = 'members' # 表的名字
    def __str__(self):
        return self.Members